package com.zhm.demo.controller.req;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@Data
public class EmqxHookConnectReq {

    public static final String EVENT="client.connected";

    /*
    {"username":"admin","timestamp":1712657674342,"sockname":"10.101.0.64:1883","receive_maximum":32,"proto_ver":4,"proto_name":"MQTT","peername":"10.101.0.232:6602","node":"emqx@127.0.0.1","mountpoint":"undefined","metadata":{"rule_id":"test-wh_WH_D"},"keepalive":180,"is_bridge":false,"expiry_interval":0,"event":"client.connected","connected_at":1712657674342,"conn_props":{"User-Property":{}},"clientid":"330022320240308","clean_start":true}
     */

    @JsonProperty("username")
    private String username;
    @JsonProperty("timestamp")
    private Long timestamp;
    @JsonProperty("sockname")
    private String sockname;
    @JsonProperty("receive_maximum")
    private Integer receiveMaximum;
    @JsonProperty("proto_ver")
    private Integer protoVer;
    @JsonProperty("proto_name")
    private String protoName;
    @JsonProperty("peername")
    private String peername;
    @JsonProperty("node")
    private String node;
    @JsonProperty("mountpoint")
    private String mountpoint;
    @JsonProperty("metadata")
    private MetadataDTO metadata;
    @JsonProperty("keepalive")
    private Integer keepalive;
    @JsonProperty("is_bridge")
    private Boolean isBridge;
    @JsonProperty("expiry_interval")
    private Integer expiryInterval;
    @JsonProperty("event")
    private String event;
    @JsonProperty("connected_at")
    private Long connectedAt;
    @JsonProperty("conn_props")
    private ConnPropsDTO connProps;
    @JsonProperty("clientid")
    private String clientid;
    @JsonProperty("clean_start")
    private Boolean cleanStart;

    @NoArgsConstructor
    @Data
    public static class MetadataDTO {
        @JsonProperty("rule_id")
        private String ruleId;
    }

    @NoArgsConstructor
    @Data
    public static class ConnPropsDTO {
        @JsonProperty("User-Property")
        private UserPropertyDTO userProperty;

        @NoArgsConstructor
        @Data
        public static class UserPropertyDTO {
        }
    }
}
